include ../../defaults.mk

LIBS	 += -lpthread
INCPATH	 += 

SOURCES = Thread.cc Mutex.cc ReaderWriter.cc # SynchronizedQueue.cc
EXE_SOURCES = testrw.cc testprodcon.cc testthread.cc

ALL_OBJECTS = $(SOURCES:.cc=.o) $(EXE_SOURCES:.cc=.o)
OBJECTS_FP = $(addprefix $(BUILD_DIR),$(SOURCES:.cc=.o))

all: $(ALL_OBJECTS) testrw testprodcon testthread

$(ALL_OBJECTS): %.o: %.cc
	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$(BUILD_DIR)$@" "$<"

testrw: $(OBJECTS_FP) $(BUILD_DIR)testrw.o
	$(CXX) $(CXXFLAGS) -o $(BIN_DIR)testrw $(BUILD_DIR)testrw.o $(OBJECTS_FP) $(LIBS) 

testprodcon: $(OBJECTS_FP) $(BUILD_DIR)testprodcon.o
	$(CXX) $(CXXFLAGS) -o $(BIN_DIR)testprodcon $(BUILD_DIR)testprodcon.o $(OBJECTS_FP) $(LIBS) 

testthread: $(OBJECTS_FP) $(BUILD_DIR)testthread.o
	$(CXX) $(CXXFLAGS) -o $(BIN_DIR)testthread $(BUILD_DIR)testthread.o $(OBJECTS_FP) $(LIBS) 


